#ifndef _KLAS_PLATFORM_HPP_
#define _KLAS_PLATFORM_HPP_

//! Platform defines the operating system klas is running on and variable types.

// Figure out what OS we are running on.
#undef KLAS_WINDOWS
#undef KLAS_LINUX
#undef KLAS_APPLE

#if defined(_WIN32) || defined(__WIN32__) 
#define KLAS_WINDOWS
#pragma warning(disable:4251) // warning about dll interfaces (not applicable)
#pragma warning(disable:4250) // warning about inheritance dominance (not applicable)


#elif defined(linux) || defined(__linux)
#define KLAS_LINUX

#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
#define KLAS_OSX

#elif defined(__FreeBSD__)
#define KLAS_FREEBSD

#else
#error This operating system is not supported by klas.
#endif

// Define a portable debug macro.
#ifndef NDEBUG
#define KLAS_DEBUG
#endif

// Allow VC++ to export the library and create .lib files.
#ifdef KLAS_WINDOWS
#define KLAS_API __declspec(dllexport)
#else
#define KLAS_API
#endif


namespace klas
{
  typedef signed char int8;
  typedef unsigned char uint8;

  typedef signed short int16;
  typedef unsigned short uint16;

  typedef signed int int32;
  typedef unsigned int uint32;

  #ifdef KLAS_WINDOWS
    typedef signed __int64 int64;
    typedef unsigned __int64 uint64;
  #else
    typedef signed long long int64;
    typedef unsigned long long uint64;
  #endif

  typedef float decimal;

  const decimal PI = 3.1415926535897932384626433832795f;
  const decimal PI_OVER_180 = 0.017453292519943295769236907684886f;
}

// Useful delete macros.
#define klasDelete(obj) if(obj) { delete(obj); obj = 0; }
#define klasDeleteArr(obj) if(obj) { delete [] obj; obj = 0; }

#endif /* _KLAS_PLATFORM_HPP_ */